package com.uzai.console.web.user;

import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.dto.user.blacklist.marketingrewards.MarketingRewardsBlackListBatchDto;
import com.uzai.console.dto.user.blacklist.marketingrewards.MarketingRewardsBlackListOptDto;
import com.uzai.console.dto.user.blacklist.marketingrewards.MarketingRewardsBlackListQuery;
import com.uzai.console.service.user.MarketingRewardsBlackListService;
import com.uzai.console.vo.user.blacklist.marketingrewards.MarketingRewardsBlackListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 营销奖励黑名单
 *
 * @author mingyang.chen create in 2023/4/13 18:15
 */
@Api(value = "营销奖励黑名单", tags = "用户管理|云黑名单|营销奖励黑名单")
@ApiSort(16)
@RestController
@RequestMapping("/blacklist/marketingRewards")
public class MarketingRewardsBlackListController {

    @Autowired
    private MarketingRewardsBlackListService marketingRewardsBlackListService;

    @ApiOperation(value = "分页查询营销奖励黑名单列表", notes = "分页查询营销奖励黑名单列表", response = MarketingRewardsBlackListVO.class)
    @PostMapping("/page")
    public Object page(@RequestBody MarketingRewardsBlackListQuery query) {
        return marketingRewardsBlackListService.page(query);
    }

    @ApiOperation(value = "添加营销奖励黑名单", notes = "添加营销奖励黑名单", response = Boolean.class)
    @PostMapping("/add")
    public Object add(@RequestBody MarketingRewardsBlackListOptDto optDto) {
        return marketingRewardsBlackListService.add(optDto);
    }

    @ApiOperation(value = "删除营销奖励黑名单", notes = "删除营销奖励黑名单", response = Boolean.class)
    @PostMapping("/remove")
    public Object remove(@RequestBody MarketingRewardsBlackListOptDto optDto) {
        return marketingRewardsBlackListService.remove(optDto.getId());
    }

    @ApiOperation(value = "批量设置下级不自动通过好友", notes = "批量设置下级不自动通过好友", response = Boolean.class)
    @PostMapping("/batch/setSubNotPassFriend")
    public Object subNotPassFriend(@RequestBody MarketingRewardsBlackListBatchDto batchDto) {
        return marketingRewardsBlackListService.batchSetSubNotPassFriend(batchDto);
    }
}
